#!/bin/expect -f

set path [lindex $argv 0]
set password [lindex $argv 1]
set timeout 6
spawn hdiutil attach ${path}
expect "请输入密码以访问*"
send ${password}\r 
expect eof